{% extends "base.html" %}

{% load crispy_forms_tags i18n translations %}

{% if can_create %}
  {% block nav_pills %}
    <ul class="nav nav-pills">
      <li class="nav-item" role="presentation">
        <a class="nav-link active" data-bs-target="#create" data-bs-toggle="tab" href="#">{% translate "Add new translation project" %}</a>
      </li>
      <li class="nav-item" role="presentation">
        <a class="nav-link" data-bs-target="#import" data-bs-toggle="tab" href="#">{% translate "Import translation project" %}</a>
      </li>
    </ul>
  {% endblock nav_pills %}

{% endif %}

{% block breadcrumbs %}
  <li class="breadcrumb-item">
    <a href="{% url 'create-project' %}">{% translate "Create project" %}</a>
  </li>
{% endblock breadcrumbs %}

{% block content %}
  {% if not can_create %}
    {% translate "You currently do not have permission to create projects." as msg %}
    {% show_message "warning" msg %}

    {% if has_billing %}
      {% include "snippets/billing-failure.html" %}
    {% endif %}

  {% else %}


    <div class="tab-content">

      <div class="tab-pane active" id="create">
        <form action="{% url 'create-project' %}" method="post" enctype="multipart/form-data">
          {% csrf_token %}
          {% crispy form %}
          <input type="submit" value="{% translate "Save" %}" class="btn btn-primary" />
        </form>
      </div>

      <div class="tab-pane" id="import">
        <form action="{% url 'create-project-import' %}"
              method="post"
              enctype="multipart/form-data">
          {% csrf_token %}
          {% crispy import_form %}
          <input type="submit" value="{% translate "Continue" %}" class="btn btn-primary" />
        </form>
      </div>

    </div>
  {% endif %}
{% endblock content %}
